#include <stdio.h>
#include "ofc/DSortedList.h"

int main(int argc, char *argv[])
{
  DSortedList *list = [DSortedList alloc];
  DText       *str;
  char        *names[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
  int          n;

  [list init :[DText class] :YES];  // Insert text in sorted list, ascending sorted

  for (n = 0; n < sizeof(names) / sizeof(names[0]); n++)  // Insert the day names, keep them sorted
  {
    DText *str = [DText new];

    [str set :names[n]];

    [list insert :str];                // Insert the string
  }

  str = [list join :','];              // Join the list for printing
  printf("Sorted day names:%s.\n", [str cstring]);
  [str free];

  [list free];                         // Cleanup 

  return 0;
}

